package com.quickcode.threadlocal.web;

import com.quickcode.threadlocal.holder.ThreadHolder;
import com.quickcode.threadlocal.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 张波 on 2019/10/23.
 */
@Slf4j
@RestController
@RequestMapping("/thread")
public class TestController {

    @Autowired
    private TestService testService;

    @GetMapping("/test")
    public Object test() {
        log.info("test controller:{}", ThreadHolder.get());
        testService.testService();
        return ThreadHolder.get();
    }

}
